import akshare as ak
import pandas as pd

# stock_zh_a_daily_df = ak.stock_zh_a_daily(symbol="sh600582");

# print(stock_zh_a_daily_df)

# # 可以将数据保存到 CSV 文件
# stock_zh_a_daily_df.to_csv(f"sh600582_history_data.csv", index=False)

import pandas as pd
import talib

# 假设这里有股票数据，以下是一个简单的示例数据
data = {
    'date': ['2023-01-01', '2023-01-02', '2023-01-03', '2023-01-04', '2023-01-05'],
    'close': [100, 105, 102, 108, 106]
}
df = pd.DataFrame(data)

# 计算 MACD 指标
df['macd'], df['macd_signal'], df['macd_hist'] = talib.MACD(df['close'])

# 计算 RSI 指标
df['rsi'] = talib.RSI(df['close'])

print(df)